class IndexController < ApplicationController
  
  def index
    @body_id = :home
    
    limit = 4
    
    @audio_assets = AudioAsset.find_recent(limit)
    @programs = Program.find_recent(limit)
    @broadcasts = Broadcast.find_recent(limit)
    
    @audio_assets_tags = AudioAsset.top_tagged
    @programs_tags = Program.top_tagged
    @broadcasts_tags = Broadcast.top_tagged
  end
  
  def tagging
    @body_id = :tagging
    # By default, the tag browser shows tags from Audio Assets
    @audio_assets_tags = AudioAsset.tag_cloud
  end
  
  # Actions to Browse Tags
  
  def audio_assets_tags
    @tags = AudioAsset.tag_cloud
    render :partial => 'shared/tag_cloud', :locals => { :tags => @tags, :controller => 'audio_assets', :title => "Audio Assets' Tags" }
  end
  
  def broadcasts_tags
    @tags = Broadcast.tag_cloud
    render :partial => 'shared/tag_cloud', :locals => { :tags => @tags, :controller => 'broadcasts', :title => "Broadcasts' Tags" }
  end
  
  def programs_tags
    @tags = Program.tag_cloud
    render :partial => 'shared/tag_cloud', :locals => { :tags => @tags, :controller => 'programs', :title => "Programs' Tags" }
  end
end